﻿<UserControl x:Class="SiteChecker.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="600" d:DesignWidth="800" 
    xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
    xmlns:local="clr-namespace:SiteChecker.ViewModels"
    xmlns:formatters="clr-namespace:SiteChecker.Formatters"
    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
    xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.SL4"
    >
    <UserControl.DataContext>
        <local:SiteListViewModel />
    </UserControl.DataContext>
    <UserControl.Resources>
        <formatters:BooleanFormatter x:Key="BooleanFormatter" />
    </UserControl.Resources>
    <Grid x:Name="LayoutRoot" Background="Black">
        <Grid.RowDefinitions>
            <RowDefinition Height="50" />
            <RowDefinition Height="*"/>
            <RowDefinition Height="20"/>
            <RowDefinition Height="20"/>
        </Grid.RowDefinitions>
        <StackPanel Grid.Row="0" Orientation="Horizontal" Margin="10" >
            <Image Source="Images/logo.png"/>
            <Button Command="{Binding LoadProfileCommand}" ToolTipService.ToolTip="Load profile" VerticalAlignment="Bottom" Margin="1" >
                <Image Source="Images/Icons/door_in.png" Margin="2"/>
            </Button>
            <Button Command="{Binding SaveProfileCommand}" ToolTipService.ToolTip="Save current profile" VerticalAlignment="Bottom" Margin="1">
                <Image Source="Images/Icons/disk.png" Margin="2"/>
            </Button>
            <Button Command="{Binding RefreshAllCommand}" ToolTipService.ToolTip="Refresh all" Margin="1">
                <Image Source="Images/Icons/arrow_refresh_small.png" Margin="2"/>
            </Button>
            <StackPanel Orientation="Horizontal" Margin="100,0,0,0" Height="23">
                <TextBlock Foreground="White" Text="http://" VerticalAlignment="Center" />
                <TextBox Width="300" x:Name="txtURL">
                    <TextBox.Text>
                        <Binding Path="NewSiteUrl" Mode="TwoWay"/>
                    </TextBox.Text>
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="KeyDown">
                            <cmd:EventToCommand Command="{Binding AddNewCommandTextBox, Mode=OneWay}" PassEventArgsToCommand="True"/>
                        </i:EventTrigger>
                    </i:Interaction.Triggers>
                </TextBox>
                <Button Command="{Binding AddNewCommand}" Margin="2" ToolTipService.ToolTip="Add new">
                    <Image Source="Images/Icons/Add.png"></Image>
                </Button>
            </StackPanel>
        </StackPanel>
        <Grid Grid.Row="1">
            <Grid.RowDefinitions>
                <RowDefinition Height="22" />
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="300" />
                <ColumnDefinition Width="30" />
                <ColumnDefinition Width="30" />
                <ColumnDefinition Width="30" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="100"/>
            </Grid.ColumnDefinitions>
            <TextBlock Grid.Row="0" Grid.Column="0" Foreground="White" Text="URL" FontWeight="Bold" HorizontalAlignment="Center" />
            <Image Grid.Row="0" Grid.Column="1" Source="Images/Icons/robot-icon.png" ToolTipService.ToolTip="Robots.txt exists?" Margin="1" />
            <Image Grid.Row="0" Grid.Column="2" Source="Images/Icons/group_add.png" ToolTipService.ToolTip="All agents?" Margin="1" />
            <Image Grid.Row="0" Grid.Column="3" Source="Images/Icons/sitemap.png" ToolTipService.ToolTip="All paths?" Margin="1" />
            <TextBlock Grid.Row="0" Grid.Column="5" Foreground="White" Text="Actions" FontWeight="Bold" HorizontalAlignment="Center" />
            <ListBox Grid.Row="1" Grid.ColumnSpan="6" ItemsSource="{Binding Sites}" Background="Black" Foreground="White">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="300" />
                                <ColumnDefinition Width="30" />
                                <ColumnDefinition Width="30" />
                                <ColumnDefinition Width="30" />
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="100"/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="20"></RowDefinition>
                            </Grid.RowDefinitions>
                            <TextBlock Grid.Column="0" Text="{Binding URL}" />
                            <Image Grid.Column="1" Source="{Binding RobotsStatus, Converter={StaticResource BooleanFormatter}}" />
                            <Image Grid.Column="2" Source="{Binding AllAgents, Converter={StaticResource BooleanFormatter}}" />
                            <Image Grid.Column="3" Source="{Binding AllAgents, Converter={StaticResource BooleanFormatter}}" />
                            <StackPanel Grid.Column="6" Orientation="Horizontal">
                                <Image Source="Images/Icons/cancel.png" ToolTipService.ToolTip="Delete"></Image>
                                <Image Source="Images/Icons/arrow_refresh_small.png" ToolTipService.ToolTip="Refresh"></Image>
                            </StackPanel>
                        </Grid>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
        </Grid>
        

        <StackPanel Grid.Row="3" Orientation="Horizontal">
            
        </StackPanel>
    </Grid>
</UserControl>
